<?php
/*
**修改用户密码类
**
*/
class chkchange 
{ //定义更改密码类
  private $uid;
  private $p1;
  private $p2;
  protected $db;
  
  function __construct($x,$y,$z,$db)  //用构造函数对类中的数据赋初值
  {
	$this->uid=$x;
	$this->p1=$y;
	$this->p2=$z;
	$this->id = $id;
  }
  function changepwd()
  { 
	$sql=mysql_query("select * from ".DB_PREFIX."users where id='$this->uid'",$this->db);
	$info=mysql_fetch_array($sql,MYSQL_ASSOC);
	if($info['password']!=$this->p1)
	{
		redirect('set.php?action=pwd', 3, '原密码输入错误，3秒钟返回！');
		//echo "<script>alert('原密码输入错误!');history.back();</script>";
		exit;
	}
	else
	{
		mysql_query("update ".DB_PREFIX."users set password='$this->p2' where id='$this->uid'",$this->db);
		redirect('set.php?action=pwd', 3, '密码修改成功，跳转中。。。');
		//echo "<script>alert('密码修改成功!');history.back();</script>";
		exit;
	}
  }
 }
 ?>